<%--
  Created by IntelliJ IDEA.
  User: taohj
  Date: 2014/6/29
  Time: 18:04
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<c:set var="menu" value="none" scope="request"></c:set>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="<%=basePath%>">
    <title>政府数据开放平台</title>
    <jsp:include page="../../commons/include.jsp"/>

    <link href="/resources/css/lib.css" rel="stylesheet">

    <script>

        $(function () {

            $('form input[value="上传"]').on('click', function () {
                $('form input[type=file]').click();
                $("form input[name='storage']").val(1);
            });


            $('form input[type=file]').on('change', function () {
                if ($(this).val()) {
                    $(this).closest("td").find("div[action='init']").css('display', 'none');
                    $(this).closest("td").find("div[action='fileUpload']").css('display', 'block');
                    $(this).closest("td").find("div[action='init']").css('display', 'none');
                    $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val($(this).val());
                }
            });


            $('form div[action="fileUpload"] input[value="删除"]').on('click', function () {
                $(this).closest("td").find("div[action='init']").css('display', 'block');
                $(this).closest("td").find("div[action='fileUpload']").css('display', 'none');
                $(this).closest("td").find("div[action='url']").css('display', 'none');
                $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
                $("form input[name='storage']").val();
            });


            $('form div[action="fileUpload"] input[value="删除"]').on('click', function () {
                $(this).closest("td").find("div[action='init']").css('display', 'block');
                $(this).closest("td").find("div[action='fileUpload']").css('display', 'none');
                $(this).closest("td").find("div[action='url']").css('display', 'none');
                $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
                $("form input[name='storage']").val();
            });


            $('form input[value="链接"]').on('click', function () {
                $(this).closest("td").find("div[action='init']").css('display', 'none');
                $(this).closest("td").find("div[action='fileUpload']").css('display', 'none');
                $(this).closest("td").find("div[action='url']").css('display', 'block');

                $("form input[name='storage']").val(2);
            });


            $('form div[action="url"] input[value="删除"]').on('click', function () {
                $(this).closest("td").find("div[action='init']").css('display', 'block');
                $(this).closest("td").find("div[action='fileUpload']").css('display', 'none');
                $(this).closest("td").find("div[action='url']").css('display', 'none');
                $(this).closest("td").find("[action='fileUpload']").find('input[type=text]').val('');
            });


        });
    </script>

</head>
<body>
<jsp:include page="../../commons/top.jsp"/>

<div class="main">



    <jsp:include page="../../commons/dashboardMenu.jsp"/>


    <div class="right">
        <form action="/front/my/app/create" method="post" enctype="multipart/form-data">

            <input type="hidden" name="storage" value="">

            <table class="updateTable">
                <tr>
                    <td>名称:</td>
                    <td><input type="text" name="name"></td>
                </tr>


                <tr>
                    <td>APP:</td>
                    <td>
                        <div style="display: block" action="init">
                            <input type="file" name="file" style="display: none">
                            <input type="button" value="上传" style="width: 60px;">
                            <input type="button" value="链接" style="width: 60px; margin-left: 30px;">
                        </div>
                        <div style="display: none" action='fileUpload'>
                            <input type="text" class="form-control"
                                   style="width: 250px; display: inline; margin-top: -16px;">
                            <input type="button" class=""
                                   style="display: inline;width: 40px; height: 32px; text-align: center; margin-top: -16px;   vertical-align: middle;padding: 0px 0px 30px 0px; "
                                   value="删除">
                        </div>


                        <div style="display: none" action='url'>
                            <input type="text" name="url" class="form-control"
                                   style="width: 250px; display: inline; margin-top: -16px;">
                            <input type="button" class=""
                                   style="display: inline;width: 40px; height: 32px; text-align: center; margin-top: -16px; vertical-align: middle;padding: 0px 0px 30px 0px; "
                                   value="删除">
                        </div>
                    </td>
                </tr>


                <tr>
                    <td>图片:</td>
                    <td>
                        <input  type="file" name="image">
                    </td>
                </tr>



                <tr>
                    <td>收藏类型：</td>
                    <td>
                         <input type="radio" dataSync="true" name="type" dictionaryType="FAVORITES_TYPE">
                    </td>
                </tr>


          


                <tr>
                    <td colspan="2" style="text-align: left;padding-left: 200px;"><input type="submit" value="新  增"/></td>
                </tr>
            </table>


        </form>
    </div>


</div>
<jsp:include page="../../commons/buttom.jsp"/>
</body>
</html>
